using System;

namespace Sustainalytics.ESGRatings.Computing.Entities.ESG
{
    public class ReferenceUniverseCompany : IEquatable<ReferenceUniverseCompany>
    {
        public ReferenceUniverseCompany(Guid companyId, string capitalIQID, string companyName)
        {
            CompanyId = companyId;
            CompanyName = companyName;
            CapitalIQID = capitalIQID;
        }

        public ReferenceUniverseCompany()
        {
        }
        //TODO: Ionut - change capitalIqId to int
        public string CapitalIQID { get; set; }

        public Guid CompanyId { get; set; }

        public string CompanyName { get; set; }

        public static bool operator !=(ReferenceUniverseCompany left, ReferenceUniverseCompany right)
        {
            return !Equals(left, right);
        }

        public static bool operator ==(ReferenceUniverseCompany left, ReferenceUniverseCompany right)
        {
            return Equals(left, right);
        }

        public bool Equals(ReferenceUniverseCompany other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }
            if (ReferenceEquals(this, other))
            {
                return true;
            }
            return this.CompanyId.Equals(other.CompanyId);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }
            if (ReferenceEquals(this, obj))
            {
                return true;
            }
            if (obj.GetType() != this.GetType())
            {
                return false;
            }
            return Equals((ReferenceUniverseCompany)obj);
        }

        public override int GetHashCode()
        {
            return this.CompanyId.GetHashCode();
        }
    }
}
